import React, { Component } from "react";
import Taro from "@tarojs/taro"
import { AtTabBar }  from 'taro-ui'
export default class Tab extends React.Component {
  constructor () {
    super(...arguments)
    this.state = {
      tabUrl:['/pages/index/index','/pages/hot/hot','/pages/classify/classify','/pages/mine/mine']
    }
  }
  handleClick (value) {
    this.setState({
      current: value
    },()=>{
      Taro.switchTab({
        url:this.state.tabUrl[value]
      })
    })
  }
  render () {
      console.log(this.props.current)
    return (
      <AtTabBar fixed current={this.props.current}
      tabList={[
        { title: '首页', iconType: 'home'},
        { title: '热榜', iconType: 'bullet-list' },
        { title: '分类', iconType: 'bullet-list' },
        { title: '我的', iconType: 'bullet-list' }
      ]}
        onClick={this.handleClick.bind(this)}
      />
    )
  } 
}
